%let NumSample=100; %let SampleSize=10000; %let prob=0.8; %let distr=geometric; data geo; call streaminit(7777); do sample=1 to &NumSample; do n=1 to &SampleSize; go=rand("Geometric",&prob); output; end; end; run; proc sgplot data=geo; histogram go; run; quit; proc means data=geo noprint mean; class sample; output out=geo_means(where=( _TYPE_=1 & _STAT_='MEAN')); run; proc print data=geo_means; run; title1 'Sampling distribution of the mean'; title2 "from &distr"; proc sgplot data=geo_means; histogram go / scale=count; density go / type=normal; run; title; %let NumSample=100; %let SampleSize=10000; %let sigma=1; %let distr=exponential; data exp; call streaminit(7777); do sample=1 to &NumSample; do n=1 to &SampleSize; eo=rand("Exponential",&sigma); output; end; end; run; proc sgplot data=exp; histogram eo; run; quit; proc means data=exp noprint mean; class sample; output out=exp_means(where=( _TYPE_=1 & _STAT_='MEAN')); run; proc print data=exp_means; run; title1 'Sampling distribution of the mean'; title2 "from &distr"; proc sgplot data=exp_means; histogram eo / scale=count; density eo / type=normal; run; title;